﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hutech.Authentication.Library.Web.Framework;
using Resources;
using Hutech.Authentication.Library.Business.WebHelpers;
using Hutech.CRM.Web;

namespace Hutech.CRM.Web.Admin
{
    public partial class SettingMenu : hutechBasePage
    {
        private bool isAuthorized = false;

        protected void Page_Load(object sender, EventArgs e)
        {
            LoadSettings();
            if (!isAuthorized)
            {
                WebUtils.SetupRedirect(this, SiteRoot + "/AccessDenied.aspx");
                return;
            }

            SecurityHelper.DisableBrowserCache();

            PopulateLabels();
            //PopulateControls();
        }
        #region Load All data
        private void PopulateLabels()
        {
            Title = Resource.AdminMenuHeading;



            liDonGia.Visible = WebUser.IsAdmin;
            lnkDonGia.Text = "Đơn giá";
            lnkDonGia.NavigateUrl = SiteRoot + "/Admin/PricesConfig.aspx";

            liHeBacDaoTao.Visible = WebUser.IsAdmin;
            lnkHeBacDaoTao.Text = "Hệ bậc đào tạo";
            lnkHeBacDaoTao.NavigateUrl = SiteRoot + "/Admin/LevelTraingManager.aspx";

            liDonVi.Visible = IsAdmin;
            lnkDonVi.Text = "Đơn vị";
            lnkDonVi.NavigateUrl = SiteRoot + "/Admin/UnixConfig.aspx";

            liHeSoChucDanh.Visible = IsAdmin;
            lnkHeSoChucDanh.Text = "Hệ số chức danh";
            lnkHeSoChucDanh.NavigateUrl = SiteRoot + "/Admin/KPositionTitleConfig.aspx";

            liQuyenThanhToan.Visible = IsAdmin;
            lnkQuyenThanhToan.Text = "Cài đặt quyền thanh toán";
            lnkQuyenThanhToan.NavigateUrl = SiteRoot + "/Admin/LoaiHinhLaoDongIsApprove.aspx";

            liDotThanhToan.Visible = IsAdmin;
            lnkDotThanhToan.Text = "Đợt thanh toán";
            lnkDotThanhToan.NavigateUrl = SiteRoot + "/Admin/DotThanhToanManager.aspx";

            liThanhToanThem.Visible = IsAdmin;
            lnkThanhToanThem.Text = "Thanh toán thêm";
            lnkThanhToanThem.NavigateUrl = SiteRoot + "/Admin/LoaiHinhLaoDongIsMoreCash.aspx";
            
        }

        private void LoadSettings()
        {
            isAuthorized = true; //Tao lao bi' dao
        }
        #endregion
    }
}
